package com.example.a2212a_park

//import coil3.ImageLoader
//import coil3.PlatformContext
//import coil3.SingletonImageLoader
//import coil3.network.okhttp.OkHttpNetworkFetcherFactory
//import coil3.request.crossfade
import com.example.base.app.app.BaseApp
import com.example.db.RoomDBUtils
import com.facebook.drawee.backends.pipeline.Fresco
import com.squareup.picasso.Picasso
import dagger.hilt.android.HiltAndroidApp

@HiltAndroidApp
class ParkApp: BaseApp(){
    override fun onCreate() {
        super.onCreate()
        //初始化Picasso
        Picasso.setSingletonInstance(Picasso.Builder(this).build())
        //初始化Fresco
        Fresco.initialize(this)
        //初始化数据库
        RoomDBUtils.initRoom(this)
        //初始化ZX
    }

//    override fun newImageLoader(context: PlatformContext): ImageLoader {
//        return ImageLoader.Builder(context)
//            .crossfade(true)
//            .components {
//                add(
//                    OkHttpNetworkFetcherFactory(
//                        callFactory = {
//                            OkHttpClient().newBuilder()
//                                .addNetworkInterceptor(Interceptor{
//                                    val headers = Headers.Builder() .set("Cache-Control","no-cache").build()
//                                    val request =it.request().newBuilder().headers(headers).build()
//                                    it.proceed(request)
//                                })
//                                .build()
//                        }
//                    )
//                )
//            }
//            .build()
//    }
}